import com.atguigu.realtime.util.SparkSqlUtil.url
import org.apache.spark.sql.{DataFrame, SparkSession}

/**
 * Author atguigu
 * Date 2020/11/17 10:34
 */
object SparkSql {
    def main(args: Array[String]): Unit = {
        val spark: SparkSession = SparkSession
            .builder()
            .master("local[*]")
            .appName("SparkSql")
            .getOrCreate()
        import spark.implicits._
    
        val df: DataFrame = spark
            .read
            .format("jdbc")
            .option("url", url)
            .option("query", "select * from gmall_user_info where id in ('1','2','3')")
            .load()
        df.show
        
        
        spark.close()
        
        
    }
}
